<?php
function openDB($path) {
  return sqlite_open($path);
}
function getConfig($db) {
  return sqlite_fetch_array(sqlite_query($db,"SELECT * FROM config"));
}
function getPage($db,$pageid) {
  return sqlite_fetch_array(sqlite_query($db,"SELECT * FROM pages WHERE id = ".$pageid));
}
function exists($db,$table,$column,$value) {
  return sqlite_fetch_single(sqlite_query($db,"SELECT $column FROM $table WHERE $column LIKE '$value'"));
}
function getLatest($db) {
  $latestid['pages'] = sqlite_fetch_single(sqlite_query($db,"SELECT id FROM pages ORDER BY id DESC"))+0;
  $latestid['tags'] = sqlite_fetch_single(sqlite_query($db,"SELECT id FROM tags ORDER BY id DESC"))+0;
  return $latestid;
}
?>